package com.hk.employeemanagementsystem.service.impl;

import com.hk.employeemanagementsystem.entity.NationEntity;
import com.hk.employeemanagementsystem.mapper.NationEntityMapper;
import com.hk.employeemanagementsystem.service.NationEntityService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author by 何坤
 * @Classname NationEntityServiceImpl
 * @Description TODO
 * @Date 2020/1/2 22:59
 */
@Service
public class NationEntityServiceImpl implements NationEntityService {

    @Resource
    private NationEntityMapper nationEntityMapper;

    @Resource
    private RedisTemplate<String, NationEntity> redisTemplate;

    @Cacheable(value = "nation", key = "'all'", unless = "#result==null || #result.size()==0")
    @Override
    public List<NationEntity> selectAllNation() {
        return nationEntityMapper.selectList(null);
    }
}
